/*     */ package com.zimbra.qa.unittest.prov;
/*     */ 
/*     */ import com.google.common.base.Strings;
/*     */ import com.google.common.collect.Maps;
/*     */ import com.zimbra.common.account.Key.AccountBy;
/*     */ import com.zimbra.common.account.Key.AlwaysOnClusterBy;
/*     */ import com.zimbra.common.account.Key.CacheEntryBy;
/*     */ import com.zimbra.common.account.Key.CalendarResourceBy;
/*     */ import com.zimbra.common.account.Key.CosBy;
/*     */ import com.zimbra.common.account.Key.DataSourceBy;
/*     */ import com.zimbra.common.account.Key.DistributionListBy;
/*     */ import com.zimbra.common.account.Key.DomainBy;
/*     */ import com.zimbra.common.account.Key.ServerBy;
/*     */ import com.zimbra.common.account.Key.UCServiceBy;
/*     */ import com.zimbra.common.account.ZAttrProvisioning.CalResType;
/*     */ import com.zimbra.cs.account.Account;
/*     */ import com.zimbra.cs.account.AlwaysOnCluster;
/*     */ import com.zimbra.cs.account.CalendarResource;
/*     */ import com.zimbra.cs.account.Config;
/*     */ import com.zimbra.cs.account.Cos;
/*     */ import com.zimbra.cs.account.DataSource;
/*     */ import com.zimbra.cs.account.DistributionList;
/*     */ import com.zimbra.cs.account.Domain;
/*     */ import com.zimbra.cs.account.DynamicGroup;
/*     */ import com.zimbra.cs.account.Group;
/*     */ import com.zimbra.cs.account.IDNUtil;
/*     */ import com.zimbra.cs.account.NamedEntry;
/*     */ import com.zimbra.cs.account.Provisioning;
/*     */ import com.zimbra.cs.account.Provisioning.CacheEntry;
/*     */ import com.zimbra.cs.account.Server;
/*     */ import com.zimbra.cs.account.UCService;
/*     */ import com.zimbra.cs.account.Zimlet;
/*     */ import com.zimbra.qa.unittest.TestUtil;
/*     */ import com.zimbra.soap.admin.type.CacheEntryType;
/*     */ import com.zimbra.soap.admin.type.DataSourceType;
/*     */ import java.util.ArrayList;
/*     */ import java.util.HashMap;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import org.junit.Assert;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public abstract class ProvTestUtil
/*     */ {
/*     */   public static final String DEFAULT_UC_PROVIDER = "mitel";
/*  63 */   private final List<NamedEntry> createdEntries = new ArrayList();
/*     */   
/*     */ 
/*  66 */   private final List<NamedEntry> createdAccountSubordinates = new ArrayList();
/*     */   
/*     */ 
/*  69 */   private final List<NamedEntry> createdDomains = new ArrayList();
/*     */   protected Provisioning prov;
/*     */   
/*     */   protected ProvTestUtil(Provisioning prov)
/*     */   {
/*  74 */     this.prov = prov;
/*     */   }
/*     */   
/*     */   public void deleteAllEntries() throws Exception {
/*  78 */     for (NamedEntry entry : this.createdAccountSubordinates) {
/*  79 */       deleteEntry(entry);
/*     */     }
/*  81 */     this.createdAccountSubordinates.clear();
/*     */     
/*  83 */     for (NamedEntry entry : this.createdEntries) {
/*  84 */       deleteEntry(entry);
/*     */     }
/*  86 */     this.createdEntries.clear();
/*     */     
/*  88 */     for (NamedEntry entry : this.createdDomains) {
/*  89 */       deleteEntry(entry);
/*     */     }
/*  91 */     this.createdDomains.clear();
/*     */   }
/*     */   
/*     */   private void deleteEntry(NamedEntry entry) throws Exception {
/*  95 */     if ((entry instanceof Account)) {
/*  96 */       this.prov.deleteAccount(entry.getId());
/*  97 */     } else if ((entry instanceof CalendarResource)) {
/*  98 */       this.prov.deleteCalendarResource(entry.getId());
/*  99 */     } else if ((entry instanceof Cos)) {
/* 100 */       this.prov.deleteCos(entry.getId());
/* 101 */     } else if ((entry instanceof Group)) {
/* 102 */       this.prov.deleteGroup(entry.getId());
/* 103 */     } else if ((entry instanceof Domain)) {
/* 104 */       this.prov.deleteDomain(entry.getId());
/* 105 */     } else if ((entry instanceof Server)) {
/* 106 */       this.prov.deleteServer(entry.getId());
/* 107 */     } else if ((entry instanceof UCService)) {
/* 108 */       this.prov.deleteUCService(entry.getId());
/* 109 */     } else if ((entry instanceof Zimlet)) {
/* 110 */       this.prov.deleteZimlet(entry.getName());
/*     */     } else {
/* 112 */       Assert.fail();
/*     */     }
/*     */   }
/*     */   
/*     */   private void flushCache(CacheEntryType type, Key.CacheEntryBy by, String key) throws Exception
/*     */   {
/* 118 */     this.prov.flushCache(type, new Provisioning.CacheEntry[] { new Provisioning.CacheEntry(by, key) });
/*     */   }
/*     */   
/*     */   public String getSystemDefaultDomainName() throws Exception {
/* 122 */     Config config = this.prov.getConfig("zimbraDefaultDomainName");
/* 123 */     String domainName = config.getAttr("zimbraDefaultDomainName", null);
/* 124 */     Assert.assertFalse(Strings.isNullOrEmpty(domainName));
/* 125 */     return domainName;
/*     */   }
/*     */   
/*     */   public Domain createDomain(String domainName) throws Exception {
/* 129 */     return createDomain(domainName, null);
/*     */   }
/*     */   
/*     */   public Domain createDomain(String domainName, Map<String, Object> attrs) throws Exception
/*     */   {
/* 134 */     if (attrs == null) {
/* 135 */       attrs = new HashMap();
/*     */     }
/*     */     
/* 138 */     Domain domain = this.prov.get(Key.DomainBy.name, domainName);
/* 139 */     Assert.assertNull(domain);
/* 140 */     domain = this.prov.createDomain(domainName, attrs);
/* 141 */     Assert.assertNotNull(domain);
/*     */     
/* 143 */     flushCache(CacheEntryType.domain, Key.CacheEntryBy.id, domain.getId());
/* 144 */     domain = this.prov.get(Key.DomainBy.name, domainName);
/* 145 */     Assert.assertNotNull(domain);
/* 146 */     Assert.assertEquals(IDNUtil.toAsciiDomainName(domainName).toLowerCase(), domain.getName().toLowerCase());
/*     */     
/*     */ 
/* 149 */     this.createdDomains.add(domain);
/* 150 */     return domain;
/*     */   }
/*     */   
/*     */   public void deleteDomain(Domain domain) throws Exception {
/* 154 */     String domainId = domain.getId();
/* 155 */     this.prov.deleteDomain(domainId);
/* 156 */     domain = this.prov.get(Key.DomainBy.id, domainId);
/* 157 */     Assert.assertNull(domain);
/*     */   }
/*     */   
/*     */   public Account createAccount(String acctName, String password, Map<String, Object> attrs) throws Exception
/*     */   {
/* 162 */     Account acct = this.prov.get(Key.AccountBy.name, acctName);
/* 163 */     Assert.assertNull(acct);
/*     */     
/* 165 */     if (password == null) {
/* 166 */       password = "test123";
/*     */     }
/* 168 */     acct = this.prov.createAccount(acctName, password, attrs);
/* 169 */     Assert.assertNotNull(acct);
/*     */     
/* 171 */     flushCache(CacheEntryType.account, Key.CacheEntryBy.id, acct.getId());
/* 172 */     acct = this.prov.get(Key.AccountBy.name, acctName);
/* 173 */     Assert.assertNotNull(acct);
/* 174 */     Assert.assertEquals(acctName.toLowerCase(), acct.getName().toLowerCase());
/*     */     
/* 176 */     this.createdEntries.add(acct);
/* 177 */     return acct;
/*     */   }
/*     */   
/*     */   public Account createAccount(String acctName, String password) throws Exception {
/* 181 */     return createAccount(acctName, password, (Map)null);
/*     */   }
/*     */   
/*     */   public Account createAccount(String acctName) throws Exception {
/* 185 */     return createAccount(acctName, (String)null, (Map)null);
/*     */   }
/*     */   
/*     */   public Account createAccount(String acctName, Map<String, Object> attrs) throws Exception {
/* 189 */     return createAccount(acctName, (String)null, attrs);
/*     */   }
/*     */   
/*     */   public Account createAccount(String localPart, Domain domain) throws Exception {
/* 193 */     return createAccount(localPart, domain, (Map)null);
/*     */   }
/*     */   
/*     */   public Account createExternalAccount(String localPart, Domain domain) throws Exception {
/* 197 */     Map<String, Object> attrs = Maps.newHashMap();
/* 198 */     attrs.put("zimbraIsExternalVirtualAccount", "TRUE");
/* 199 */     return createAccount(localPart, domain, attrs);
/*     */   }
/*     */   
/*     */   public Account createAccount(String localPart, Domain domain, Map<String, Object> attrs) throws Exception
/*     */   {
/* 204 */     String acctName = TestUtil.getAddress(localPart, domain.getName());
/* 205 */     return createAccount(acctName, attrs);
/*     */   }
/*     */   
/*     */   public void deleteAccount(Account acct) throws Exception {
/* 209 */     String acctId = acct.getId();
/* 210 */     this.prov.deleteAccount(acctId);
/* 211 */     acct = this.prov.get(Key.AccountBy.id, acctId);
/* 212 */     Assert.assertNull(acct);
/*     */     
/*     */ 
/* 215 */     flushCache(CacheEntryType.account, Key.CacheEntryBy.id, acctId);
/* 216 */     acct = this.prov.get(Key.AccountBy.id, acctId);
/* 217 */     Assert.assertNull(acct);
/*     */   }
/*     */   
/*     */   public Account createGlobalAdmin(String acctName, String password) throws Exception {
/* 221 */     Map<String, Object> attrs = Maps.newHashMap();
/* 222 */     attrs.put("zimbraIsAdminAccount", "TRUE");
/* 223 */     return createAccount(acctName, password, attrs);
/*     */   }
/*     */   
/*     */   public Account createGlobalAdmin(String localPart, Domain domain, String password) throws Exception
/*     */   {
/* 228 */     String acctName = TestUtil.getAddress(localPart, domain.getName());
/* 229 */     return createGlobalAdmin(acctName, password);
/*     */   }
/*     */   
/*     */   public Account createGlobalAdmin(String localPart, Domain domain) throws Exception {
/* 233 */     String acctName = TestUtil.getAddress(localPart, domain.getName());
/* 234 */     return createGlobalAdmin(acctName, (String)null);
/*     */   }
/*     */   
/*     */   public Account createGlobalAdmin(String acctName) throws Exception {
/* 238 */     return createGlobalAdmin(acctName, (String)null);
/*     */   }
/*     */   
/*     */   public Account createDelegatedAdmin(String acctName, String password) throws Exception {
/* 242 */     Map<String, Object> attrs = Maps.newHashMap();
/* 243 */     attrs.put("zimbraIsDelegatedAdminAccount", "TRUE");
/* 244 */     return createAccount(acctName, password, attrs);
/*     */   }
/*     */   
/*     */   public Account createDelegatedAdmin(String acctName) throws Exception {
/* 248 */     return createDelegatedAdmin(acctName, (String)null);
/*     */   }
/*     */   
/*     */   public Account createDelegatedAdmin(String localPart, Domain domain, String password) throws Exception {
/* 252 */     String acctName = TestUtil.getAddress(localPart, domain.getName());
/* 253 */     return createDelegatedAdmin(acctName, password);
/*     */   }
/*     */   
/*     */   public Account createDelegatedAdmin(String localPart, Domain domain) throws Exception {
/* 257 */     return createDelegatedAdmin(localPart, domain, (String)null);
/*     */   }
/*     */   
/*     */   public Account createSystemAccount(String acctName) throws Exception {
/* 261 */     Map<String, Object> attrs = Maps.newHashMap();
/* 262 */     attrs.put("zimbraIsSystemAccount", "TRUE");
/* 263 */     return createAccount(acctName, attrs);
/*     */   }
/*     */   
/*     */   public Account createSystemAccount(String localPart, Domain domain) throws Exception {
/* 267 */     String acctName = TestUtil.getAddress(localPart, domain.getName());
/* 268 */     return createSystemAccount(acctName);
/*     */   }
/*     */   
/*     */   public Account createSystemResource(String acctName) throws Exception {
/* 272 */     Map<String, Object> attrs = Maps.newHashMap();
/* 273 */     attrs.put("zimbraIsSystemResource", "TRUE");
/* 274 */     return createAccount(acctName, attrs);
/*     */   }
/*     */   
/*     */   public Account createSystemResource(String localPart, Domain domain) throws Exception {
/* 278 */     String acctName = TestUtil.getAddress(localPart, domain.getName());
/* 279 */     return createSystemResource(acctName);
/*     */   }
/*     */   
/*     */   public CalendarResource createCalendarResource(String localPart, Domain domain, Map<String, Object> attrs)
/*     */     throws Exception
/*     */   {
/* 285 */     if (attrs == null) {
/* 286 */       attrs = new HashMap();
/* 287 */       attrs.put("displayName", localPart);
/* 288 */       attrs.put("zimbraCalResType", ZAttrProvisioning.CalResType.Equipment.name());
/*     */     }
/*     */     
/* 291 */     String crName = TestUtil.getAddress(localPart, domain.getName());
/* 292 */     CalendarResource cr = this.prov.get(Key.CalendarResourceBy.name, crName);
/* 293 */     Assert.assertNull(cr);
/*     */     
/* 295 */     cr = this.prov.createCalendarResource(crName, "test123", attrs);
/* 296 */     Assert.assertNotNull(cr);
/*     */     
/* 298 */     flushCache(CacheEntryType.account, Key.CacheEntryBy.id, cr.getId());
/* 299 */     cr = this.prov.get(Key.CalendarResourceBy.name, crName);
/* 300 */     Assert.assertNotNull(cr);
/* 301 */     Assert.assertEquals(crName.toLowerCase(), cr.getName().toLowerCase());
/*     */     
/* 303 */     this.createdEntries.add(cr);
/* 304 */     return cr;
/*     */   }
/*     */   
/*     */   public CalendarResource createCalendarResource(String localPart, Domain domain) throws Exception
/*     */   {
/* 309 */     return createCalendarResource(localPart, domain, null);
/*     */   }
/*     */   
/*     */   public Group createGroup(String groupName, Map<String, Object> attrs, boolean dynamic) throws Exception
/*     */   {
/* 314 */     Group group = this.prov.getGroup(Key.DistributionListBy.name, groupName);
/* 315 */     Assert.assertNull(group);
/*     */     
/* 317 */     if (attrs == null) {
/* 318 */       attrs = new HashMap();
/*     */     }
/*     */     
/* 321 */     group = this.prov.createGroup(groupName, attrs, dynamic);
/* 322 */     Assert.assertNotNull(group);
/*     */     
/* 324 */     flushCache(CacheEntryType.group, Key.CacheEntryBy.id, group.getId());
/* 325 */     group = this.prov.getGroup(Key.DistributionListBy.name, groupName);
/* 326 */     Assert.assertNotNull(group);
/* 327 */     Assert.assertEquals(groupName.toLowerCase(), group.getName().toLowerCase());
/*     */     
/* 329 */     this.createdEntries.add(group);
/* 330 */     return group;
/*     */   }
/*     */   
/*     */   public Group createGroup(String groupName, boolean dynamic) throws Exception
/*     */   {
/* 335 */     return createGroup(groupName, (Map)null, dynamic);
/*     */   }
/*     */   
/*     */   public Group createGroup(String localPart, Domain domain, Map<String, Object> attrs, boolean dynamic)
/*     */     throws Exception
/*     */   {
/* 341 */     String groupName = TestUtil.getAddress(localPart, domain.getName());
/* 342 */     return createGroup(groupName, attrs, dynamic);
/*     */   }
/*     */   
/*     */   public Group createGroup(String localPart, Domain domain, boolean dynamic) throws Exception
/*     */   {
/* 347 */     return createGroup(localPart, domain, null, dynamic);
/*     */   }
/*     */   
/*     */   public Group createAdminGroup(String groupName, boolean dynamic) throws Exception
/*     */   {
/* 352 */     Map<String, Object> attrs = Maps.newHashMap();
/* 353 */     attrs.put("zimbraIsAdminGroup", "TRUE");
/* 354 */     return createGroup(groupName, attrs, dynamic);
/*     */   }
/*     */   
/*     */   public Group createAdminGroup(String groupName) throws Exception
/*     */   {
/* 359 */     return createAdminGroup(groupName, false);
/*     */   }
/*     */   
/*     */   public Group createAdminGroup(String localPart, Domain domain, boolean dynamic) throws Exception
/*     */   {
/* 364 */     String groupName = TestUtil.getAddress(localPart, domain.getName());
/* 365 */     return createAdminGroup(groupName, dynamic);
/*     */   }
/*     */   
/*     */   public Group createAdminGroup(String localPart, Domain domain) throws Exception
/*     */   {
/* 370 */     String groupName = TestUtil.getAddress(localPart, domain.getName());
/* 371 */     return createAdminGroup(groupName);
/*     */   }
/*     */   
/*     */   public void deleteGroup(Group group) throws Exception
/*     */   {
/* 376 */     String groupId = group.getId();
/* 377 */     this.prov.deleteGroup(groupId);
/* 378 */     group = this.prov.get(Key.DistributionListBy.id, groupId);
/* 379 */     Assert.assertNull(group);
/*     */     
/*     */ 
/* 382 */     flushCache(CacheEntryType.group, Key.CacheEntryBy.id, groupId);
/* 383 */     group = this.prov.get(Key.DistributionListBy.id, groupId);
/* 384 */     Assert.assertNull(group);
/*     */   }
/*     */   
/*     */   public DistributionList createDistributionList(String localPart, Domain domain) throws Exception
/*     */   {
/* 389 */     return createDistributionList(localPart, domain, null);
/*     */   }
/*     */   
/*     */   public DistributionList createDistributionList(String localPart, Domain domain, Map<String, Object> attrs) throws Exception
/*     */   {
/* 394 */     return (DistributionList)createGroup(localPart, domain, attrs, false);
/*     */   }
/*     */   
/*     */   public void deleteDistributionList(DistributionList dl) throws Exception
/*     */   {
/* 399 */     String dlId = dl.getId();
/* 400 */     this.prov.deleteDistributionList(dl.getId());
/* 401 */     dl = this.prov.get(Key.DistributionListBy.id, dlId);
/* 402 */     Assert.assertNull(dl);
/*     */     
/*     */ 
/* 405 */     flushCache(CacheEntryType.group, Key.CacheEntryBy.id, dlId);
/* 406 */     dl = this.prov.get(Key.DistributionListBy.id, dlId);
/* 407 */     Assert.assertNull(dl);
/*     */   }
/*     */   
/*     */   public DynamicGroup createDynamicGroup(String localPart, Domain domain, Map<String, Object> attrs) throws Exception
/*     */   {
/* 412 */     return (DynamicGroup)createGroup(localPart, domain, attrs, true);
/*     */   }
/*     */   
/*     */   public DynamicGroup createDynamicGroup(String localPart, Domain domain) throws Exception
/*     */   {
/* 417 */     return (DynamicGroup)createGroup(localPart, domain, null, true);
/*     */   }
/*     */   
/*     */   public void deleteDynamicGroup(DynamicGroup group) throws Exception {
/* 421 */     deleteGroup(group);
/*     */   }
/*     */   
/*     */   public Cos createCos(String cosName) throws Exception {
/* 425 */     return createCos(cosName, null);
/*     */   }
/*     */   
/*     */   public Cos createCos(String cosName, Map<String, Object> attrs) throws Exception
/*     */   {
/* 430 */     Cos cos = this.prov.get(Key.CosBy.name, cosName);
/* 431 */     Assert.assertNull(cos);
/*     */     
/* 433 */     if (attrs == null) {
/* 434 */       attrs = new HashMap();
/*     */     }
/*     */     
/* 437 */     cos = this.prov.createCos(cosName, attrs);
/* 438 */     Assert.assertNotNull(cos);
/*     */     
/* 440 */     flushCache(CacheEntryType.cos, Key.CacheEntryBy.id, cos.getId());
/* 441 */     cos = this.prov.get(Key.CosBy.name, cosName);
/* 442 */     Assert.assertNotNull(cos);
/* 443 */     Assert.assertEquals(cosName.toLowerCase(), cos.getName().toLowerCase());
/*     */     
/* 445 */     this.createdEntries.add(cos);
/* 446 */     return cos;
/*     */   }
/*     */   
/*     */   public void deleteCos(Cos cos) throws Exception {
/* 450 */     String codId = cos.getId();
/* 451 */     this.prov.deleteCos(codId);
/* 452 */     cos = this.prov.get(Key.CosBy.id, codId);
/* 453 */     Assert.assertNull(cos);
/*     */     
/*     */ 
/* 456 */     flushCache(CacheEntryType.cos, Key.CacheEntryBy.id, codId);
/* 457 */     cos = this.prov.get(Key.CosBy.id, codId);
/* 458 */     Assert.assertNull(cos);
/*     */   }
/*     */   
/*     */   public Server createServer(String serverName, Map<String, Object> attrs) throws Exception
/*     */   {
/* 463 */     if (attrs == null) {
/* 464 */       attrs = new HashMap();
/*     */     }
/* 466 */     Server server = this.prov.get(Key.ServerBy.name, serverName);
/* 467 */     Assert.assertNull(server);
/*     */     
/* 469 */     server = this.prov.createServer(serverName, attrs);
/* 470 */     Assert.assertNotNull(server);
/*     */     
/* 472 */     server = this.prov.get(Key.ServerBy.name, serverName);
/* 473 */     Assert.assertNotNull(server);
/* 474 */     Assert.assertEquals(serverName.toLowerCase(), server.getName().toLowerCase());
/*     */     
/* 476 */     this.createdEntries.add(server);
/* 477 */     return server;
/*     */   }
/*     */   
/*     */   public AlwaysOnCluster createAlwaysOnCluster(String alwaysOnClusterName, Map<String, Object> attrs) throws Exception
/*     */   {
/* 482 */     if (attrs == null) {
/* 483 */       attrs = new HashMap();
/*     */     }
/* 485 */     AlwaysOnCluster cluster = this.prov.get(Key.AlwaysOnClusterBy.name, alwaysOnClusterName);
/* 486 */     Assert.assertNull(cluster);
/*     */     
/* 488 */     cluster = this.prov.createAlwaysOnCluster(alwaysOnClusterName, attrs);
/* 489 */     Assert.assertNotNull(cluster);
/*     */     
/* 491 */     cluster = this.prov.get(Key.AlwaysOnClusterBy.name, alwaysOnClusterName);
/* 492 */     Assert.assertNotNull(cluster);
/* 493 */     Assert.assertEquals(alwaysOnClusterName.toLowerCase(), cluster.getName().toLowerCase());
/*     */     
/* 495 */     this.createdEntries.add(cluster);
/* 496 */     return cluster;
/*     */   }
/*     */   
/*     */   public Server createServer(String serverName) throws Exception {
/* 500 */     return createServer(serverName, null);
/*     */   }
/*     */   
/*     */   public AlwaysOnCluster createAlwaysOnCluster(String alwaysOnClusterName) throws Exception {
/* 504 */     return createAlwaysOnCluster(alwaysOnClusterName, null);
/*     */   }
/*     */   
/*     */   public UCService createUCService(String ucServiceName, Map<String, Object> attrs) throws Exception
/*     */   {
/* 509 */     if (attrs == null) {
/* 510 */       attrs = new HashMap();
/* 511 */       attrs.put("zimbraUCProvider", "mitel");
/*     */     }
/*     */     
/* 514 */     UCService ucService = this.prov.get(Key.UCServiceBy.name, ucServiceName);
/* 515 */     Assert.assertNull(ucService);
/*     */     
/* 517 */     ucService = this.prov.createUCService(ucServiceName, attrs);
/* 518 */     Assert.assertNotNull(ucService);
/*     */     
/* 520 */     ucService = this.prov.get(Key.UCServiceBy.name, ucServiceName);
/* 521 */     Assert.assertNotNull(ucService);
/* 522 */     Assert.assertEquals(ucServiceName.toLowerCase(), ucService.getName().toLowerCase());
/*     */     
/* 524 */     this.createdEntries.add(ucService);
/* 525 */     return ucService;
/*     */   }
/*     */   
/*     */   public UCService createUCService(String serverName) throws Exception {
/* 529 */     return createUCService(serverName, null);
/*     */   }
/*     */   
/*     */   public void deleteServer(Server server) throws Exception {
/* 533 */     String serverId = server.getId();
/* 534 */     this.prov.deleteServer(serverId);
/* 535 */     server = this.prov.get(Key.ServerBy.id, serverId);
/* 536 */     Assert.assertNull(server);
/*     */   }
/*     */   
/*     */   public DataSource createDataSourceRaw(Account acct, String dataSourceName) throws Exception
/*     */   {
/* 541 */     Map<String, Object> attrs = new HashMap();
/* 542 */     attrs.put("zimbraDataSourceEnabled", "TRUE");
/* 543 */     attrs.put("zimbraDataSourceFolderId", "123");
/* 544 */     attrs.put("zimbraDataSourceConnectionType", "ssl");
/* 545 */     attrs.put("zimbraDataSourceHost", "zimbra.com");
/* 546 */     attrs.put("zimbraDataSourcePort", "9999");
/* 547 */     DataSource ds = this.prov.createDataSource(acct, DataSourceType.pop3, dataSourceName, attrs);
/*     */     
/* 549 */     this.createdAccountSubordinates.add(ds);
/* 550 */     return ds;
/*     */   }
/*     */   
/*     */   public DataSource createDataSource(Account acct, String dataSourceName) throws Exception
/*     */   {
/* 555 */     DataSource dataSource = this.prov.get(acct, Key.DataSourceBy.name, dataSourceName);
/* 556 */     Assert.assertNull(dataSource);
/*     */     
/* 558 */     dataSource = createDataSourceRaw(acct, dataSourceName);
/* 559 */     Assert.assertNotNull(dataSource);
/*     */     
/* 561 */     dataSource = this.prov.get(acct, Key.DataSourceBy.name, dataSourceName);
/* 562 */     Assert.assertNotNull(dataSource);
/* 563 */     Assert.assertEquals(dataSourceName, dataSource.getName());
/*     */     
/* 565 */     return dataSource;
/*     */   }
/*     */   
/*     */   public void deleteDataSource(Account acct, DataSource dataSource) throws Exception
/*     */   {
/* 570 */     String dataSourceId = dataSource.getId();
/* 571 */     this.prov.deleteDataSource(acct, dataSourceId);
/* 572 */     dataSource = this.prov.get(acct, Key.DataSourceBy.id, dataSourceId);
/* 573 */     Assert.assertNull(dataSource);
/*     */   }
/*     */   
/*     */   public Zimlet createZimlet(String zimletName, Map<String, Object> attrs) throws Exception
/*     */   {
/* 578 */     Zimlet zimlet = this.prov.createZimlet(zimletName, attrs);
/* 579 */     this.createdEntries.add(zimlet);
/* 580 */     return zimlet;
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/qa/unittest/prov/ProvTestUtil.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */